package com.bijava.controller;

import com.bijava.annotation.BusLog;
import com.bijava.entity.BuslogBean;
import com.bijava.utils.IpUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

/**
 * @author bijava
 * @version 1.0
 * @since 20-9-8
 */
@Slf4j
@RestController
@BusLog(name = "测试日志类", descrip = "测试日志类")
public class SyslogController {
    @PostMapping("/test")
    @BusLog(name = "添加人员信息", descrip = "添加人员信息")
    public String add(@RequestBody BuslogBean buslogBean, HttpServletRequest request) {
        log.info("//增加person执行完成");
        try {
            String ipAddr = IpUtils.getIpAddr(request);
            String cityInfo = IpUtils.getCityInfo(ipAddr);
            return buslogBean.getBusName() + "-" + ipAddr + "-" + cityInfo;
        } catch (Exception e) {
            e.printStackTrace();
        }

        return null;
    }
}